{extend name="public:base"}
{block name='css'}
<link href="__PUBLIC__/css/plugins/iCheck/custom.css" rel="stylesheet">
{/block}
{block name="js"}
<script src="__PUBLIC__/js/plugins/peity/jquery.peity.min.js"></script>
<script src="__PUBLIC__/js/content.min.js?v=1.0.0"></script>
<script type="text/javascript">
    function setLocks(self) {
        if ($(self).hasClass('ed')) {
            return false;
        }

        var id = $(self).attr('data-id');
        var locks = $(self).attr('data-locks');

        $(self).addClass('ed');
        var obj = showMyLoading();
        $.post("{:url('locks')}", {id:id,locks:locks}, function(data){
            hideMyLoading(obj);
            layer.msg(data.info);
            if (data.status == 'y') {
                if (locks == 1) {
                    $(self).attr('class', 'btn btn-danger btn-xs delete').attr('data-locks', '0').text('是');
                } else {
                    $(self).attr('class', 'btn btn-info btn-xs edit').attr('data-locks', '1').text('否');
                }
            } else {
                $(self).removeClass('ed');
            }
        }, 'json');
    }
</script>
{/block}
{block name='body'}

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">

        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>管理员</h5>
						<a href="{:url('add')}" class="btn btn-sm btn-primary pull-right m-t-n-xs">添加管理员</a>
                    </div>
                    <div class="ibox-content">
						<div class="row">
							<form name="form" action="{:url('index')}" method="get">
								<div class="col-sm-2 m-b-xs">
                                    <select class="form-control m-b" name="locks" style="height:30px;padding:4px 12px;">
                                    	<option value="">锁定！</option>
                                    	<option value="0">否</option>
                                    	<option value="1">是</option>
                                    </select>
                                </div>
                                <div class="col-sm-4 m-b-xs">
                                    <div class="input-group">
                                        <input type="text" name="keywords" placeholder="姓名/帐号/电话" class="input-sm form-control"> <span class="input-group-btn">
                                        <button type="submit" class="btn btn-sm btn-primary"> 搜索</button> </span>
                                    </div>
                                </div>
							</form>
                        </div>
                        <table class="table table-hover">
                            <thead>
                                <tr>
                                    <th>帐号</th>
                                    <th>姓名</th>
                                    <th>电话</th>
                                    <th>头像</th>
                                    <th>锁定</th>
                                    <th>用户组</th>
                                    <th>添加时间</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
								{foreach name="list" item="li"}
                                <tr>
                                    <td>{$li.username}</td>
                                    <td>{$li.truename}</td>
                                    <td>{$li.tel}</td>
                                    <td><img src="{$li.img|default='/static/manager/img/default.jpg'}" style="width:40px;height:40px;border-radius:50%;" /></td>
                                    <td>
										{if condition="$li['locks'] eq 0"}
											<a href="javascript:;" onclick="setLocks(this)" data-id="{$li.id}" data-locks="1" class="btn btn-primary btn-xs edit">否</a>
										{else /}
											<a href="javascript:;" onclick="setLocks(this)" data-id="{$li.id}" data-locks="0" class="btn btn-danger btn-xs delete">是</a>
										{/if}
									</td>
                                    <td>{$li.groupname}</td>
                                    <td>{$li.time|date="Y-m-d H:i:s",###}</td>
                                    <td>
										<a href="{:url('save',array('id'=>$li['id']))}" class="btn btn-primary btn-xs edit"><i class="fa fa-edit"></i> 编辑</a>
	                                    <a href="javascript:;" onclick="return del({$li.id});" class="btn btn-danger btn-xs delete"><i class="fa fa-trash-o"></i> 删除</a>
									</td>
                                </tr>
								{/foreach}
                            </tbody>
							<tfoot>
								<tr>
                                    <td colspan="8">
										<div class="zy_page">{$list->render()}</div>
									</td>
                                </tr>
							</tfoot>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        
    </div>

    
</body>
{/block}
